export const Clone = function (a, b) {
  a = a || {};
  for (let n in b) {
    a[n]
      ? (a[n] = {
          ...a[n],
          ...b[n],
        })
      : (a[n] = b[n]);
  }
  return a;
};

export const MClone = function (a, b) {
  a = a || {};
  for (let i = 0; i < b.length; i++) {
    a = Clone(a, b[i]);
    if (a) continue;
  }
  return a;
};

export const log = function () {
  console.log.apply(console, ["[提示]", ...arguments]);
};

export const findUpFilter = function (target, name, filter) {
  if (!target) return;
  let current = target[name],
    res = filter(current);
  if (res) {
    return res;
  } else {
    return current && findUpFilter(current, name, filter);
  }
};
